package com.xh.bussiness.course.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xh.core.model.SuperEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("bk_prepare_lesson_score")
public class PrepareLessonScore extends SuperEntity {

    /**
     * 备课id
     */
    @NotNull(message = "备课id不能为空")
    private String  prepareLessonId;
    /**
     * 教学目标
     */
    private Double teachTarget;
    /**
     *教学过程
     */
    private Double teachProcess;
    /**
     * 教学准备
     */
    private Double teachPlan;
    /**
     * 板书设计
     */
    private Double templatePlan;
    /**
     * 教师反思
     */
    private Double teacherRethink;
    /**
     *情境导入
     */
    private Double situationImport;
    /**
     * 还课评分-教学目标
     */
    private Double videoTeachTarget;
    /**
     * 教学过程与方法
     */
    private Double teachProcessMethod;
    /**
     * 教学效果
     */
    private Double teachResult;
    /**
     * 教学基本功
     */
    private Double teachBasicTraining;
    /**
     * 备课质量评分
     */
    @TableField(exist = false)
    private Double teachePlanScore;
    /**
     * 还课评分
     */
    @TableField(exist = false)
    private Double videoScore;

    public Double getTotalScore() {
        Double totalScore = 50.0;
        if(this.teachTarget != null){
            totalScore += teachTarget;
        }
        if(this.teachProcess != null){
            totalScore += teachProcess;
        }
        if(this.teachPlan != null){
            totalScore += teachPlan;
        }
        if(this.templatePlan != null){
            totalScore += templatePlan;
        }
        if(this.teacherRethink != null){
            totalScore += teacherRethink;
        }
        if(this.situationImport != null){
            totalScore += situationImport;
        }
        if(this.videoTeachTarget != null){
            totalScore += videoTeachTarget;
        }
        if(this.teachProcessMethod != null){
            totalScore += teachProcessMethod;
        }
        if(this.teachResult != null){
            totalScore += teachResult;
        }
        if(this.teachBasicTraining != null){
            totalScore += teachBasicTraining;
        }
        return totalScore > 50.0 ? totalScore : 0;
    }

    public Double getTeachePlanScore() {
        teachePlanScore = 0.0;
        if(this.teachTarget != null){
            teachePlanScore += teachTarget;
        }
        if(this.teachProcess != null){
            teachePlanScore += teachProcess;
        }
        if(this.teachPlan != null){
            teachePlanScore += teachPlan;
        }
        if(this.templatePlan != null){
            teachePlanScore += templatePlan;
        }
        if(this.teacherRethink != null){
            teachePlanScore += teacherRethink;
        }
        return teachePlanScore;
    }

    public Double getVideoScore() {
        videoScore = 0.0;
        if(this.situationImport != null){
            videoScore += situationImport;
        }
        if(this.videoTeachTarget != null){
            videoScore += videoTeachTarget;
        }
        if(this.teachProcessMethod != null){
            videoScore += teachProcessMethod;
        }
        if(this.teachResult != null){
            videoScore += teachResult;
        }
        if(this.teachBasicTraining != null){
            videoScore += teachBasicTraining;
        }
        return videoScore;
    }
}
